package org.xussen.dic;

import java.util.Comparator;

public class ChildrenNumComparator implements Comparator<Node> {
	
	public static ChildrenNumComparator instance = new ChildrenNumComparator();

	private ChildrenNumComparator() {}
	
	@Override
	public int compare(Node o1, Node o2) {
		Node node1 = o1;
		Node node2 = o2;
		if(node1.branches.length>node2.branches.length) {
			return -1;
		} else if (node1.branches.length<node2.branches.length) {
			return 1;
		} else {
			return 0;
		}
	}

}
